<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>我的发布</title>

	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
	<link rel="stylesheet" href="css/student_homework.css">
	<link rel="stylesheet" href="css/student_homework_detalis.css">
	<link rel="stylesheet" href="../css/main.css">
	<style>
		h3 {
			font-size: 25px;
			margin: 0 0;
			letter-spacing: 5px;
		}

		.content {
			margin-top: 20px;
			border: 1px solid #eceaff;
			background: #eceaff;
			border-radius: 5px;
		}
	</style>
</head>

<body style="background: #eceaff;">
	<div class="container">
		<div class="contain" id="vue-root">
			<div class="header">
				<div class="header_title">发布详情</div>
				<a href="student_homework.html">
					<img src="../image/return.png" alt="" class="return">
				</a>
			</div>
			<div style="height: 40px;"></div>
			<div class="content">
				<div class="homework_content">
					<h3 class="homework_info" v-text="homework.courseName+'作业'"></h3>
					<div class="homework_info" v-text="homework.publishTime"></div>
					<div class="homework_info" v-text="join(homework.classesNames)"></div>
					<div class="homework_info" v-text="homework.title"></div>
					<textarea id="text1" class="info" disabled="disabled" :value="homework.content"></textarea>
				</div>

				<div class="img_box" v-for="(pic,index) in homework.pics" :key="index">
					<img :src="getImg(pic)" class="homework_img" />
				</div>

				<div class="answer_num">已答学生<span>{{homework.count}}/{{homework.total}}</span></div>
			</div>

		</div>

	</div>

	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	<script src="/scriptZIP/axios.min.js"></script>


	<script src="/js/common.js"></script>

	<script>

		var teacher = getTeacher();

		var app = new Vue({
			el: '#vue-root',
			data: {
				homework: {
					classesNames: []
				}
			},
			created: function () {
				var id = params().id;
				if (!id) {
					alert('参数错误');
					throw '找不到id';
				}
				axios.get('/t/homework/' + id).then(function (res) {
					var data = res.data;
					data.pics = data.pics ? data.pics.split('|') : [];
					this.homework = data;
				}.bind(this));
			},
			methods: {
				getImg: function (pic) {
					return '/static/' + teacher.schoolId + '/homework/' + pic;
				},
				join: function (classesNames) {
					return classesNames.join('、');
				}
			}
		});

	</script>

</body>

</html>